<h2>Paris sur <%= @competition.nom %></h2>

<!-- affichage des groups -->
<table>
<% for groupe in @competition.groupe %>
   	<tr>
   		<th colspan="2" align=center>Groupe <%= groupe.nom %></th>
		</tr>
			
			<% for match in groupe.match %>
				<% @res = MatchsParieur.find(:first, :conditions => ["parieur_id = ? and match_id = ?",session[:user], match.id]) %>
				
				<tr><td><%= match.equipea.nom %></td><td> vs </td><td><%= match.equipeb.nom %></td>
				<td><%= form_tag :action => 'parier', :res => 1, :id => match.id, :idC => @competition.id %>
				<%= submit_tag "1" %><%= end_form_tag %></td>
				<td><%= form_tag :action => 'parier', :res => 0, :id => match.id, :idC => @competition.id %>
				<%= submit_tag "X" %><%= end_form_tag %></td>
				<td><%= form_tag :action => 'parier', :res => 2, :id => match.id, :idC => @competition.id %>
				<%= submit_tag "2" %><%= end_form_tag %></td>
				<% if !@res.nil?%>
					<td>Pari sur
					<% if @res.resultat == 1%>
						<%= match.equipea.nom %>
					<% elsif @res.resultat == 0 %>
						match nul
					<% else %>
						<%= match.equipeb.nom %>
					<% end %></td>
					<td><%= form_tag :action => 'annuler', :id => @res.id, :idC => @competition.id %>
					<%= submit_tag "Annuler" %><%= end_form_tag %></td>
				<% end %>
			<% end %>
		
<% end %>
</table>

<br/>
<br/>

<%= link_to 'Retour', :controller => "competitions", :action => 'show', :id => @competition.id %>
